<template>

  <Ncards v-for="i in CardsData"
          :DetailNoticeData="i"
          :notice_type="i.notice_type"
          :public_notice_id="i.public_notice_id"
          :title="i.notice_title"
          :author="i.notice_author"
          :content="i.notice_content"
          :times="i.notice_release_date"
          :img_src="i.img_src">

  </Ncards>
  <el-empty v-show="loading" style="height: 800px;" :image-size="200"></el-empty>
</template>

<script>

import Ncards from './NoticeCards'
import axios from 'axios'

export default {
  name: 'cards',
  components: { Ncards },
  data () {
    return {
      loading: true,
      CardsData: [],
    }
  },
  created () {
    const _this = this
    axios.get('http://localhost:8080/Get_Public_noticeWithImage')
      .then(function (response) {
        _this.CardsData = response.data
        for (let i = 0; i < _this.CardsData.length; i = i + 1) {
          //console.log(_this.CardsData[i].img_src)
          const temp = _this.CardsData[i].img_src.substr(19)
          //console.log(temp)
          _this.CardsData[i].img_src = require('E:/job/NoticeImage/' + temp)
        }
        //console.log(_this.CardsData)
        _this.loading = false
      })
      .catch(function (error) {
        console.log(error)
      })
  }
}
</script>

<style scoped>

</style>
